<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>
<html>
<head>
<script type="text/JavaScript">
function uploadFlv(self) {
	//alert(111);
	var filepath = $(self).val();
	var extStart = filepath.lastIndexOf(".");
	var ext = filepath.substring(extStart, filepath.length).toUpperCase();
	if (ext != ".FLV" ) {
		alert("图片限于FLV格式");
		return;
	}
	$(self).parent().ajaxSubmit(
			{
				dataType : 'json',
				cache : false,
				success : function(map) {
					//alert(data.imageServer);
					//$(self).parent().find("img:first").attr("src",data.imageServer + data.imageUrl);
					if(map.date){
						alert("上传成功");
						document.getElementById("staError").innerHTML="<BR>文件路径："+map.flvUrl;
						$("#flvUrl").val(map.flvUrl);
					}else{
						alert("上传失败了");
						document.getElementById("staError").innerHTML="请重新上传";
					}
				} 
			});
	return false;
}
function saveFlv(){
	$.post("/misc/artPic/saveFlv.htm", {
		src : $("#flvUrl").val(),
		descript : $("#descript").val(),
		picture : $("#imagePath").attr("src"),
		roomId : $("#roomId").val()
	}, function(data) {
		if (data == "success") {
			alert("添加成功！");
		}
		if (data == "error") {
			$.ligerDialog.warn("系统有点抽经，请稍候重试！");
		}
	});
}
</script>
</head>
<body>
	<table width="60%" border="0" align="center" cellpadding="0"
		cellspacing="0" style="margin-top: 20px; margin-bottom: 15px;">
		<tr>
			<td align="center"><font size="3"><b> 添加FLV文件 </b>
			</font>
			</td>
		</tr>
		<tr>
			<td align="center"><FONT SIZE="" COLOR="red">*</FONT>&nbsp;<font
				size="2">为必填项</font>
			</td>
		</tr>
	</table>
	
		<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top: 20px; margin-bottom: 15px;">
			<tr>
				<td width="20%" height="50" align="center" class="borderbottomright">视频文件</td>
				<td width="80%" class="borderbottom">
					<form action="/misc/artPic/uploadFlv.htm" id="soft_add" name="data_add" method="post" enctype="multipart/form-data">
						<input type="file" name="dataFile" id="dataFile" style="width: 310px;" onchange="uploadFlv(this);return false;""  /> 
						<FONT SIZE="" COLOR="red" style="font-size: 12px">* </FONT> 
						<span id="staError" style="font-size: 9pt; font-family: 黑体; color: red"></span> 
						<FONT SIZE="" COLOR="red" style="font-size: 12px"><br />文件名格式如：2_v110.flv </FONT>
					</form>
					<input type="hidden" value=" " id="flvUrl">
				</td>
			</tr>
		</table>
	
	<table width="60%" border="0" align="center" cellpadding="0"
		cellspacing="0" class="borderquan">
		<tr>
			<td width="20%" height="50" align="center" class="borderbottomright">视频截图</td>
			<td width="80%" class="borderbottom">
				<form id="upload_img_form" enctype="multipart/form-data" method="post" action="/misc/artPic/uploadImg.htm">
								<input type="file" onchange="uploadCmsImg(this);return false;""  style="width: 200px;" title="支持jpg、jpeg、gif、png格式，文件小于2M" name="imagecontent" id="imagecontent1" />
								<img src="${artPic.imagePath}" alt="" class="user_img" id="imagePath" width="100px;"height="100px" />　
							</form>
			</td>
		</tr>
		<tr>
			<td width="20%" height="30" align="center" class="borderbottomright">描述</td>
			<td width="80%" class="borderbottom">
			<label> 
			<textarea name="descInfo" style="width: 310px;" rows="5" id="descript"></textarea> 
			<input type="hidden" value="${roomId }" id="roomId">
			</label>
			</td>
		</tr>
		<tr>
			<td height="30" colspan="2" align="center"><input type="button" name="save" class="myBtn" value="保　存" onclick="saveFlv()"/></td>
		</tr>
	</table>
</body>
</html>